#!/usr/bin/python
import sys

k=0
sum=0
avg=0
if len(sys.argv)<3:
	print 'not enough arguments: enter value of type \n ./power_averager.py [Source path] [preferred destination path]'
else:
	f=open(sys.argv[1])
	g=open(sys.argv[2],"w")
	twn=f.readlines()
	print "length of file is: ",len(twn)
	while k!=len(twn):
		l=42
		pwn=""
		swn=""
		p=0		
		while twn[k][l]!="\n":
			pwn=pwn+twn[k][l]
			l=l+1	
	
		sum+=int(pwn)
		k=k+1
		if k%10==0:
			avg=sum/10
			sum=0
			while p!=42:
				swn=swn+twn[k][p]
				p=p+1
			g.write(swn+str(avg)+"\n")
			avg=0
	f.close()
	g.close()
print "done"
